#define _CRT_SECURE_NO_WARNINGS 1
class Solution {
public:
    int maxProduct(vector<int>& nums)
    {
        int first = nums[0], second = nums[1];
        if (second > first)
        {
            swap(first, second);
        }
        for (int i = 2;i < nums.size();++i)
        {
            if (nums[i] > second)
            {
                second = nums[i];
            }
            if (second > first)
            {
                swap(second, first);
            }
        }
        return (first - 1) * (second - 1);
    }
};